<%@page import="com.wanmait.cookbook.vo.Userinfo"%>
<%@page import="com.wanmait.cookbook.vo.RecipeTypeSecond"%>
<%@page import="com.wanmait.cookbook.vo.RecipeType"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
    <%
    String path=request.getContextPath();
    %>
    
    <link rel="stylesheet" type="text/css" href="<%=path %>/static/css/style1.css">
    <link rel="stylesheet" href="<%=path %>/static/css/main.css">
    <link rel="stylesheet" href="<%=path %>/static/css/remind.css">
    <script type="text/javascript" src="<%=path %>/static/js/jquery-3.5.1.min.js"></script>
<!--导航栏-->
    <div id="header" class="">
    <script></script>
    <div class="header clearfix">

        

        <a class="logo left" href=""><img src="<%=path %>/static/image/nangua.jpg" alt=""></a>

        <ul class="nav">
            <li ><a href="<%=path%>">首页</a></li>
            <li  class="relative " onmouseover="javascript:$(&#39;.ctip&#39;).show();" onmouseout="javascript:$(&#39;.ctip&#39;).hide();">        
                <a  href="<%=path%>/HotCookbookShowListServlet?action=getOnePageCookbook">食谱 ∨ <span class="naww"></span></a>
				 <div class="ctip" style="display: none;">
                    <span class="arwwj"> </span>
                    
                    <div class="cblok clearfix" id="recipeType">
				<!-- 菜谱的jsp （recipeTypeSecondInc.jsp） -->
 
                    </div>
                    <div class="cmore">
                        <a href="<%=path %>/indexServlet?action=getAllRecipeType" target="_blank">查看全部分类 <img src="./static/image/more2.png" alt=""></a>
                    </div>
                </div>
            </li> 
         <!--  -->
            <li class="relative" >
                <a href="<%=path %>/indexServlet?action=getAllIngredientType" style="height:50px;">食材 ∨ <span class="nawwa"></span></a>
                <div class="healthy" style="display: none;">
                    <span class="arwww"> </span>
                <div class="cblok clearfix" id="ingredientType">
                    	<!-- 食谱的jsp （ingredientTypeSecondInc.jsp） -->
                </div>
                </div>
            </li>
            <li><a href="<%=path%>/HotWorksServlet?action=allOnePagerWorksInc">作品</a></li>
         
        </ul>
        
        <!-- 搜索框开始 -->
       
        <form class="search br4 left" method="POST" id="searchForm" action="<%=path %>/FindBoxServlet?action=find" accept-charset="utf-8" >
            <input type="text" id="global_search_inpt" class="sput" value="" placeholder="搜索菜谱、菜单、食材、用户" name="keywords" >
            <input type="button" value="🔍" class="lib" id="find">
           <!--   <div class="sugg2" id="mysu2" style="display:none;"></div>-->
        </form>
        
        <script>
        	$(function(){
        		
        		$("#find").click(function(){
        			$("#searchForm").submit();
        		});
        	});
        </script>
        <!-- 搜索框结束 -->
        
        

    <div class="pubt" onmouseover="javascript:$(&#39;.pubt-box&#39;).show();" onmouseout="javascript:$(&#39;.pubt-box&#39;).hide();"> 
    	<a class="btn-pubt" href="<%=path %>/CookbookServlet?action=init">发布</a> 
     </div>
        


        <%Userinfo userinfo = (Userinfo)session.getAttribute("userinfo");
        if(userinfo==null){
        %>     
		<div class="perinfo"> <a class="login" href="<%=path%>/login.jsp"> 登录 </a> | <a class="register"  href="<%=path %>/registe.jsp" target="_blank"> 注册 </a></div>

        <%}else{ %>
        <div class="perinfo" data-id="<%=userinfo.getId()%>">
        	<header class="site-header header-opt-1" style="width: 100">
            <div class=""  >
                    <ul class="nav-top-right dagon-nav">
                    <li class="menu-item-has-children">
                    <a href="<%=path %>/PersonalServlet?action=init&id=<%=userinfo.getId() %>" class="dropdown-toggle">
                    <img width="40" style="border-radius: 40px" height="40" src="<%=path %>/static/image/<%=userinfo.getAvatar() %>" alt="flag">

                    (<span id="count" style="color:red">0</span>)
                    <i class="fa fa-angle-down" aria-hidden="true">欢迎：<%=userinfo.getName() %></i>
                    </a>
                        <ul  style="text-align:center" class="submenu parent-megamenu">
                            <li  class="switcher-option">
                                <a href="<%=path %>/usercenter/updatePassword.jsp" class="flag">修改密码</a>
                            </li>
                            <li class="switcher-option">
                                <a href="<%=path %>/UserInfoServlet?action=reviseUserinfo" class="flag">修改资料</a>
                            </li>
                            <li class="switcher-option">
                                <a href="<%=path %>/CookbookServlet?action=showDraft" class="flag">草稿箱</a>
                            </li>
                            <li class="switcher-option">
                                <a href="<%=path %>/NewsServlet?action=commentNews&id=<%=userinfo.getId() %>" class="flag">消息通知</a>
                                <span id="count1" style="color:red">0</span>
                            </li>
                            <li class="switcher-option">
                                 <a href="<%=path %>/UserInfoServlet?action=exit" class="flag">退出</a> 
                           		
                            </li>
                        </ul>
                    </li>
			</ul>
    	</div>
    </header> 
        </div>
        <%} %>

    </div>
    
</div>
 <!--导航栏结束-->   
 
 <script type="text/javascript">
	$(function(){
		//食谱的ajax方法
		$(".naww").parent().mouseover(function(){
			$(".ctip").css("display","block");
			 $.ajax({
				url:"<%=path%>/indexServlet",
				data:{action:"init"},
				success:function(mes){
					$("#recipeType").html(mes);
				}
			}); 
			
		});
		$(".naww").parent().mouseout(function(){
			$(".ctip").css("display","none");
		});
		$(".ctip").parent().mouseout(function(){
			$(".ctip").css("display","none");
		});
		$(".ctip").parent().mouseover(function(){
			$(".ctip").css("display","block");
		});
		
		
		//食材的ajax方法
		$(".nawwa").parent().mouseover(function(){
			$(".healthy").css("display","block");
			 $.ajax({
				url:"<%=path%>/indexServlet",
				data:{action:"initIngredients"},
				success:function(mes){
					$("#ingredientType").html(mes);
				}
			}); 
			
		});
		$(".nawwa").parent().mouseout(function(){
			$(".healthy").css("display","none");
		});
		$(".healthy").parent().mouseout(function(){
			$(".healthy").css("display","none");
		});
		$(".healthy").parent().mouseover(function(){
			$(".healthy").css("display","block");
		});
		
	});
	
</script>
<script type="text/javascript">
$(function(){
	if(<%=userinfo!=null%>){
		var id=$(".perinfo").data("id");
		$.ajax({
			url:"<%=path%>/NewsServlet?action=getAllNews",
			data:{id:id},
			success:function(mes){
				$("#count").html(mes);
				$("#count1").html(mes);
				
			}
		})
	}
})
</script>
 